# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         可变参数
# Description:
# Author:       asus
# Date:         2019/3/6
#-------------------------------------------------------------------------------

#def hello(*name,type='+')#推荐直接在这里定义type
def hello(*name,type):#"*"代表参数可变
    sum = 0
    if type == '*':
        sum = 1
    for item in name:
        if type == '+':
            sum += item
        elif type == '*':
            sum *= item

    return sum  #返回值

if __name__ == '__main__':
    ret = hello(1,2,3,4,5,6,7,type='*')
    print(ret)

    ret = hello(1, 2, 3, 4, 5, 6, 7, type='+')
    print(ret)